﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows.Media;

namespace ClippingMaster
{
    public class NewsBackgroundConverter :IValueConverter
    {
        static Color openedColor = Colors.LightBlue;
        static Color uploadedColor = Colors.LightGreen;
        static NewsBackgroundConverter()
        { 
        
        }
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            NewsModel nm = value as NewsModel;
            if (nm == null)
                return null;
            else 
            {
                if (nm.UploadedClients != null && nm.UploadedClients.Count > 0)
                    return uploadedColor;
                else if (nm.Opened)
                    return openedColor;
                else
                    return null;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
